package SpringBoot.spring_boot_starter_thymeleaf.WebThymeleaf;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import SpringBoot.spring_boot_starter_thymeleaf.WebThymeleaf.vo.Person;

/**
 * 
 */

@Controller
@SpringBootApplication
public class Application {
	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
	
	@RequestMapping("/")
	public String index(Model model) {
		Person single = new Person("a", 11);
		model.addAttribute("single", single);
		
		List<Person> people = new ArrayList<Person>();
		people.add(new Person("l1", 11));
		people.add(new Person("l2", 22));
		people.add(new Person("l3", 33));
		model.addAttribute("people", people);
		
		return "/SpringBoot/WebThymeleaf/templates/hello";
	}
}
